#coding:utf-8
from Marchines import NB

listOPosts,listClasses = NB.loadDataSet()
myvocabList = NB.createVocabList(listOPosts)
print(myvocabList)

print(NB.setOfWords2Vec(myvocabList,listOPosts[0]))
print(NB.setOfWords2Vec(myvocabList,listOPosts[3]))


trainMat = []

for postinDoc in listOPosts:
    trainMat.append(NB.setOfWords2Vec(myvocabList,postinDoc))

p0V,p1V,pAb = NB.trainNB0(trainMat,listClasses)

print(pAb)

print(p0V)

print(p1V)
